<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div>
    <el-form ref="form" :model="s_search" :rules="rules" label-width="100px" id="mvcfm">
      <div class="form-unit">
        <span class="mvc-title-left"> 搜索产品 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="产品类别" prop="product_classid">
              <el-select style='width:100%' v-model="s_search.product_classid">
                <el-option label="全部" value="全部" />
                <el-option label="产品" value="1" />
                <el-option label="自制件" value="2" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="产品名称" prop="product_name">
              <el-input v-model="s_search.product_name" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="产品型号" prop="product_model">
              <el-input v-model="s_search.product_model" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="产品规格" prop="product_norm">
              <el-input v-model="s_search.product_norm" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item>
              <el-button @click="('')" type='success' size="mini"><i class='fa fa-check'></i>搜索</el-button>
              <el-button @click="resetQuery" type='primary' size="mini"><i class='fa fa-refresh'></i>重置</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div class="form-unit">
        <span class="mvc-title-left"> 产品列表 </span>
      </div>
      <el-table :data="produce">
        <el-table-column label="#" align="center" type='index'>
        </el-table-column>
        <el-table-column label="" prop="product_id" width="80">
          <template slot-scope="scope">
            <el-button @click="$parent.$parent.closeProductSelection1(scope.row['product_id'],scope.row['product_name']);" type="success" size="mini"><i class="fa fa-edit"></i>选择</el-button>
          </template>
        </el-table-column>
        <el-table-column label="产品条形码" prop="product_barcode">
        </el-table-column>
        <el-table-column label="类型" prop="class_namebar">
        </el-table-column>
        <el-table-column label="所属系列" prop="series_name">
        </el-table-column>
        <el-table-column label="产品名称" prop="product_name">
        </el-table-column>
        <el-table-column label="产品型号" prop="product_model">
        </el-table-column>
        <el-table-column label="产品规格" prop="product_norm">
        </el-table-column>
        <el-table-column label="日生产能力" prop="allthroughput">
        </el-table-column>
      </el-table>
      <pagination v-show="total>0" :total="total" :limit.sync="pageSize" @pagination="getPage" />
    </el-form>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'ProductSelection1',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        s_search: {
          product_classid: null,
          product_name: null,
          product_model: null,
          product_norm: null,
        },
        produce: [],
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/main/CommonSelect/productSelection1?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
          this["l_class"] = this.loadTreeTable(this["l_class"], "product_classid", "product_higher");
        })
      },
    },
  }
</script>
